
define(["./dom", "./builder", "_"], function(dom, builder, _) {
  var clear, container, create, iframe, iframeDocument, write;
  container = null;
  iframe = null;
  iframeDocument = null;
  write = function(content) {
    iframeDocument.open();
    iframeDocument.write(content);
    return iframeDocument.close();
  };
  clear = function() {
    write("");
    container.hide();
    return false;
  };
  create = function() {
    if (container) {
      return;
    }
    container = builder(".t-exception-container", ["iframe"], ["div > button.pull-right.btn.btn-primary", "Close"]);
    dom.body().append(container.hide());
    iframe = (container.findFirst("iframe")).element;
    iframeDocument = iframe.contentWindow || iframe.contentDocument;
    if (iframeDocument.document) {
      iframeDocument = iframeDocument.document;
    }
    return container.on("click", "button", clear);
  };
  return function(exceptionContent) {
    create();
    write(exceptionContent);
    return container.show();
  };
});
